<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    header {
      width: 100%;
      min-height: 155px;
      height: 9.375vw;
      --percentage: 0.5;
      position: relative;
    }
    header .moving {
      transition: .2s all ease-in;
    }
    header .banner_vid {
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: center;
    }
    header .banner_vid .video {
      width:120%;
      object-fit: cover;
      transform: translateX(calc(var(--percentage)* -60px)) scale(1);
    }
    header .banner_logo {
      position: absolute;
      top: 40%;
      left: 12%;
    }
    header .banner_logo a {
      display: block;
    }
    .logo {
      width: 176px;
      height: 84px;
    }
  </style>
</head>
<body>
  <header>
    <div class="banner_vid">
      <video class="video" src="./video/banner.webm" autoplay loop muted></video>
    </div>
    <div class="banner_logo">
      <a href="https://www.bilibili.com/">
        <img class="logo" src="./image/10641bbc5189591221c00958f3458f33798c7caa.png" alt="logo">
      </a>
    </div>
  </header>
  
</body>
<script>
  // 定义触发元素体
  let header = document.querySelector('header')
  // 定义起始点
  let startPoint
  header.addEventListener('mouseover', e =>{
    startPoint = e.clientX
  })
  header.addEventListener('mousemove',function (e) {
    let percentage = (e.clientX - startPoint ) / window.outerWidth + 0.5
    header.style.setProperty('--percentage',percentage)
  })
</script>
</html>